package com.hnevc;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import java.time.Instant;

public class LoginActivity extends AppCompatActivity {

    EditText mEtUsername;
    EditText mEtPassword;
    Button mEtLogin;
    Button mEtCancel;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        initView();
        inEvent();
    }

    private void inEvent() {
        mEtLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String userName = mEtUsername.getText().toString();
                String passWord = mEtPassword.getText().toString();
                if (userName.equals("admin")&&passWord.equals("123")){
                    Intent intent = new Intent(LoginActivity.this,TeamsActivity.class);
                    startActivity(intent);
                }else{
                    Toast.makeText(LoginActivity.this, "ndjb", Toast.LENGTH_SHORT).show();

                }
            }
        });
    }

    private void initView() {
        mEtUsername = findViewById(R.id.et_user_name);
        mEtPassword = findViewById(R.id.et_password);
        mEtLogin = findViewById(R.id.btn_login);
        mEtCancel = findViewById(R.id.btn_cancel);
    }
}
